
set more off
clear


cd "D:\Projects\HeterogeneousExternalities\Data\"

use GMaps.dta,clear


bysort OD: egen freeflow=max(speed)
gen speed_diff=-freeflow+speed
collapse (mean) speed veh speed_diff (first)  urban_13 , by( county_fips)


replace veh=veh/100
twoway scatter veh speed_diff if urban==1, mlwidth(vthin) mcolor(%95) || scatter veh speed_diff if urban==2, mlwidth(vthin) mcolor(%75) /*
*/ || scatter veh speed_diff if urban==3 , mlwidth(vthin) mcolor(%75) || /*
*/ scatter veh speed_diff if urban==4, mlwidth(vthin) mcolor(%75) /*
*/ || lfit veh speed_diff , lstyle(p7) lpattern(l) xlabel(,nogrid) ylabel(,nogrid) /*
*/  xtitle(Deviation from Free-Flow Speed (MPH)) ytitle(Traffic Counts (100's)) /*
*/ legend(label(1 "Large Central Metro")/*
	*/label(2 "Large Fringe Metro") label(3 "Medium Metro") label(4 "Small Metro") pos(11) col(3) )  legend(size(medium)) 
